/*
 * Filename TestRecordDetailController.java 2022年03月25日
 * Copyright © Ehome Co.Ltd. All Rgiths Reserved.
 * @author wuyingchao
 */
package com.ehome.poct.core.controller;

import com.ehome.poct.core.api.dto.check.TestRecordDetailDTO;
import com.ehome.poct.core.api.virtual.TestRecordDetailService;
import com.ehome.poct.core.api.vo.checkdata.TestRecordDetailVO;
import com.ehome.web.annotation.RequestLog;
import com.ehome.web.controller.AbstractBaseController;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author wyc
 * @since 2022/03/25 16:26
 **/
@RestController
@AllArgsConstructor
@Api(tags = "检测数据")
@ApiSupport(author = "wyc")
@RequestMapping("/check/records")
public class TestRecordDetailController extends AbstractBaseController<TestRecordDetailVO, TestRecordDetailDTO> {
    private final TestRecordDetailService recordDetailService;

    @ApiOperation("保存记录")
    @ApiOperationSupport(author = "wyc")
    @PostMapping("/batch")
    @RequestLog
    public void batchSave(@RequestBody List<TestRecordDetailDTO> records) {
        recordDetailService.saveRecord(records);
    }

    @ApiOperation("修改检测记录")
    @ApiOperationSupport(author = "wyc")
    @PutMapping("/updateRecord")
    @RequestLog
    public TestRecordDetailVO updateRecord(@RequestBody TestRecordDetailDTO recordDetailDTO) {
        return recordDetailService.updateRecordInfo(recordDetailDTO);
    }
}